home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / python2.5 / locale.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2007-05-11  |  42.4 KB  |  1,507 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. """ Locale support.
  5.  
  6.     The module provides low-level access to the C lib's locale APIs
  7.     and adds high level number formatting APIs as well as a locale
  8.     aliasing engine to complement these.
  9.  
  10.     The aliasing engine includes support for many commonly used locale
  11.     names and maps them to values suitable for passing to the C lib's
  12.     setlocale() function. It also includes default encodings for all
  13.     supported locale names.
  14.  
  15. """
  16. import sys
  17. import encodings
  18. import encodings.aliases as encodings
  19. __all__ = [
  20.     'setlocale',
  21.     'Error',
  22.     'localeconv',
  23.     'strcoll',
  24.     'strxfrm',
  25.     'format',
  26.     'str',
  27.     'atof',
  28.     'atoi',
  29.     'LC_CTYPE',
  30.     'LC_COLLATE',
  31.     'LC_TIME',
  32.     'LC_MONETARY',
  33.     'LC_NUMERIC',
  34.     'LC_ALL',
  35.     'CHAR_MAX']
  36.  
  37. try:
  38.     from _locale import *
  39. except ImportError:
  40.     CHAR_MAX = 127
  41.     LC_ALL = 6
  42.     LC_COLLATE = 3
  43.     LC_CTYPE = 0
  44.     LC_MESSAGES = 5
  45.     LC_MONETARY = 4
  46.     LC_NUMERIC = 1
  47.     LC_TIME = 2
  48.     Error = ValueError
  49.     
  50.     def localeconv():
  51.         ''' localeconv() -> dict.
  52.             Returns numeric and monetary locale-specific parameters.
  53.         '''
  54.         return {
  55.             'grouping': [
  56.                 127],
  57.             'currency_symbol': '',
  58.             'n_sign_posn': 127,
  59.             'p_cs_precedes': 127,
  60.             'n_cs_precedes': 127,
  61.             'mon_grouping': [],
  62.             'n_sep_by_space': 127,
  63.             'decimal_point': '.',
  64.             'negative_sign': '',
  65.             'positive_sign': '',
  66.             'p_sep_by_space': 127,
  67.             'int_curr_symbol': '',
  68.             'p_sign_posn': 127,
  69.             'thousands_sep': '',
  70.             'mon_thousands_sep': '',
  71.             'frac_digits': 127,
  72.             'mon_decimal_point': '',
  73.             'int_frac_digits': 127 }
  74.  
  75.     
  76.     def setlocale(category, value = None):
  77.         ''' setlocale(integer,string=None) -> string.
  78.             Activates/queries locale processing.
  79.         '''
  80.         if value not in (None, '', 'C'):
  81.             raise Error, '_locale emulation only supports "C" locale'
  82.         
  83.         return 'C'
  84.  
  85.     
  86.     def strcoll(a, b):
  87.         ''' strcoll(string,string) -> int.
  88.             Compares two strings according to the locale.
  89.         '''
  90.         return cmp(a, b)
  91.  
  92.     
  93.     def strxfrm(s):
  94.         ''' strxfrm(string) -> string.
  95.             Returns a string that behaves for cmp locale-aware.
  96.         '''
  97.         return s
  98.  
  99.  
  100.  
  101. def _group(s, monetary = False):
  102.     conv = localeconv()
  103.     if not monetary or 'mon_thousands_sep':
  104.         pass
  105.     thousands_sep = conv['thousands_sep']
  106.     if not monetary or 'mon_grouping':
  107.         pass
  108.     grouping = conv['grouping']
  109.     if not grouping:
  110.         return (s, 0)
  111.     
  112.     result = ''
  113.     seps = 0
  114.     spaces = ''
  115.     if s[-1] == ' ':
  116.         sp = s.find(' ')
  117.         spaces = s[sp:]
  118.         s = s[:sp]
  119.     
  120.     while s and grouping:
  121.         if grouping[0] == CHAR_MAX:
  122.             break
  123.         elif grouping[0] != 0:
  124.             group = grouping[0]
  125.             grouping = grouping[1:]
  126.         
  127.         if result:
  128.             result = s[-group:] + thousands_sep + result
  129.             seps += 1
  130.         else:
  131.             result = s[-group:]
  132.         s = s[:-group]
  133.         if s and s[-1] not in '0123456789':
  134.             return (s + result + spaces, seps)
  135.             continue
  136.     if not result:
  137.         return (s + spaces, seps)
  138.     
  139.     if s:
  140.         result = s + thousands_sep + result
  141.         seps += 1
  142.     
  143.     return (result + spaces, seps)
  144.  
  145.  
  146. def format(percent, value, grouping = False, monetary = False, *additional):
  147.     """Returns the locale-aware substitution of a %? specifier
  148.     (percent).
  149.  
  150.     additional is for format strings which contain one or more
  151.     '*' modifiers."""
  152.     if percent[0] != '%':
  153.         raise ValueError('format() must be given exactly one %char format specifier')
  154.     
  155.     if additional:
  156.         formatted = percent % ((value,) + additional)
  157.     else:
  158.         formatted = percent % value
  159.     if percent[-1] in 'eEfFgG':
  160.         seps = 0
  161.         parts = formatted.split('.')
  162.         if grouping:
  163.             (parts[0], seps) = _group(parts[0], monetary = monetary)
  164.         
  165.         if not monetary or 'mon_decimal_point':
  166.             pass
  167.         decimal_point = localeconv()['decimal_point']
  168.         formatted = decimal_point.join(parts)
  169.         while seps:
  170.             sp = formatted.find(' ')
  171.             if sp == -1:
  172.                 break
  173.             
  174.             formatted = formatted[:sp] + formatted[sp + 1:]
  175.             seps -= 1
  176.     elif percent[-1] in 'diu':
  177.         if grouping:
  178.             formatted = _group(formatted, monetary = monetary)[0]
  179.         
  180.     
  181.     return formatted
  182.  
  183. import re
  184. import operator
  185. _percent_re = re.compile('%(?:\\((?P<key>.*?)\\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
  186.  
  187. def format_string(f, val, grouping = False):
  188.     '''Formats a string in the same way that the % formatting would use,
  189.     but takes the current locale into account.
  190.     Grouping is applied if the third parameter is true.'''
  191.     percents = list(_percent_re.finditer(f))
  192.     new_f = _percent_re.sub('%s', f)
  193.     if isinstance(val, tuple):
  194.         new_val = list(val)
  195.         i = 0
  196.         for perc in percents:
  197.             starcount = perc.group('modifiers').count('*')
  198.             new_val[i] = format(perc.group(), new_val[i], grouping, False, *new_val[i + 1:i + 1 + starcount])
  199.             del new_val[i + 1:i + 1 + starcount]
  200.             i += 1 + starcount
  201.         
  202.         val = tuple(new_val)
  203.     elif operator.isMappingType(val):
  204.         for perc in percents:
  205.             key = perc.group('key')
  206.             val[key] = format(perc.group(), val[key], grouping)
  207.         
  208.     else:
  209.         val = format(percents[0].group(), val, grouping)
  210.     return new_f % val
  211.  
  212.  
  213. def currency(val, symbol = True, grouping = False, international = False):
  214.     '''Formats val according to the currency settings
  215.     in the current locale.'''
  216.     conv = localeconv()
  217.     if not international or 'int_frac_digits':
  218.         pass
  219.     digits = conv['frac_digits']
  220.     if digits == 127:
  221.         raise ValueError("Currency formatting is not possible using the 'C' locale.")
  222.     
  223.     s = format('%%.%if' % digits, abs(val), grouping, monetary = True)
  224.     s = '<' + s + '>'
  225.     if symbol:
  226.         if not international or 'int_curr_symbol':
  227.             pass
  228.         smb = conv['currency_symbol']
  229.         if not val < 0 or 'n_cs_precedes':
  230.             pass
  231.         precedes = conv['p_cs_precedes']
  232.         if not val < 0 or 'n_sep_by_space':
  233.             pass
  234.         separated = conv['p_sep_by_space']
  235.         if precedes:
  236.             if not separated or ' ':
  237.                 pass
  238.             s = smb + '' + s
  239.         elif not separated or ' ':
  240.             pass
  241.         s = s + '' + smb
  242.     
  243.     if not val < 0 or 'n_sign_posn':
  244.         pass
  245.     sign_pos = conv['p_sign_posn']
  246.     if not val < 0 or 'negative_sign':
  247.         pass
  248.     sign = conv['positive_sign']
  249.     if sign_pos == 0:
  250.         s = '(' + s + ')'
  251.     elif sign_pos == 1:
  252.         s = sign + s
  253.     elif sign_pos == 2:
  254.         s = s + sign
  255.     elif sign_pos == 3:
  256.         s = s.replace('<', sign)
  257.     elif sign_pos == 4:
  258.         s = s.replace('>', sign)
  259.     else:
  260.         s = sign + s
  261.     return s.replace('<', '').replace('>', '')
  262.  
  263.  
  264. def str(val):
  265.     '''Convert float to integer, taking the locale into account.'''
  266.     return format('%.12g', val)
  267.  
  268.  
  269. def atof(string, func = float):
  270.     '''Parses a string as a float according to the locale settings.'''
  271.     ts = localeconv()['thousands_sep']
  272.     if ts:
  273.         string = string.replace(ts, '')
  274.     
  275.     dd = localeconv()['decimal_point']
  276.     if dd:
  277.         string = string.replace(dd, '.')
  278.     
  279.     return func(string)
  280.  
  281.  
  282. def atoi(str):
  283.     '''Converts a string to an integer according to the locale settings.'''
  284.     return atof(str, int)
  285.  
  286.  
  287. def _test():
  288.     setlocale(LC_ALL, '')
  289.     s1 = format('%d', 123456789, 1)
  290.     print s1, 'is', atoi(s1)
  291.     s1 = str(3.14)
  292.     print s1, 'is', atof(s1)
  293.  
  294. _setlocale = setlocale
  295.  
  296. def normalize(localename):
  297.     ''' Returns a normalized locale code for the given locale
  298.         name.
  299.  
  300.         The returned locale code is formatted for use with
  301.         setlocale().
  302.  
  303.         If normalization fails, the original name is returned
  304.         unchanged.
  305.  
  306.         If the given encoding is not known, the function defaults to
  307.         the default encoding for the locale code just like setlocale()
  308.         does.
  309.  
  310.     '''
  311.     fullname = localename.lower()
  312.     if ':' in fullname:
  313.         fullname = fullname.replace(':', '.')
  314.     
  315.     if '.' in fullname:
  316.         (langname, encoding) = fullname.split('.')[:2]
  317.         fullname = langname + '.' + encoding
  318.     else:
  319.         langname = fullname
  320.         encoding = ''
  321.     norm_encoding = encoding.replace('-', '')
  322.     norm_encoding = norm_encoding.replace('_', '')
  323.     lookup_name = langname + '.' + encoding
  324.     code = locale_alias.get(lookup_name, None)
  325.     if code is not None:
  326.         return code
  327.     
  328.     code = locale_alias.get(langname, None)
  329.     if code is not None:
  330.         if '.' in code:
  331.             (langname, defenc) = code.split('.')
  332.         else:
  333.             langname = code
  334.             defenc = ''
  335.         if encoding:
  336.             norm_encoding = encodings.normalize_encoding(encoding)
  337.             norm_encoding = encodings.aliases.aliases.get(norm_encoding, norm_encoding)
  338.             encoding = locale_encoding_alias.get(norm_encoding, norm_encoding)
  339.         else:
  340.             encoding = defenc
  341.         if encoding:
  342.             return langname + '.' + encoding
  343.         else:
  344.             return langname
  345.     else:
  346.         return localename
  347.  
  348.  
  349. def _parse_localename(localename):
  350.     ''' Parses the locale code for localename and returns the
  351.         result as tuple (language code, encoding).
  352.  
  353.         The localename is normalized and passed through the locale
  354.         alias engine. A ValueError is raised in case the locale name
  355.         cannot be parsed.
  356.  
  357.         The language code corresponds to RFC 1766.  code and encoding
  358.         can be None in case the values cannot be determined or are
  359.         unknown to this implementation.
  360.  
  361.     '''
  362.     code = normalize(localename)
  363.     if '@' in code:
  364.         (code, modifier) = code.split('@')
  365.         if modifier == 'euro' and '.' not in code:
  366.             return (code, 'iso-8859-15')
  367.         
  368.     
  369.     if '.' in code:
  370.         return tuple(code.split('.')[:2])
  371.     elif code == 'C':
  372.         return (None, None)
  373.     
  374.     raise ValueError, 'unknown locale: %s' % localename
  375.  
  376.  
  377. def _build_localename(localetuple):
  378.     ''' Builds a locale code from the given tuple (language code,
  379.         encoding).
  380.  
  381.         No aliasing or normalizing takes place.
  382.  
  383.     '''
  384.     (language, encoding) = localetuple
  385.     if language is None:
  386.         language = 'C'
  387.     
  388.     if encoding is None:
  389.         return language
  390.     else:
  391.         return language + '.' + encoding
  392.  
  393.  
  394. def getdefaultlocale(envvars = ('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
  395.     ''' Tries to determine the default locale settings and returns
  396.         them as tuple (language code, encoding).
  397.  
  398.         According to POSIX, a program which has not called
  399.         setlocale(LC_ALL, "") runs using the portable \'C\' locale.
  400.         Calling setlocale(LC_ALL, "") lets it use the default locale as
  401.         defined by the LANG variable. Since we don\'t want to interfere
  402.         with the current locale setting we thus emulate the behavior
  403.         in the way described above.
  404.  
  405.         To maintain compatibility with other platforms, not only the
  406.         LANG variable is tested, but a list of variables given as
  407.         envvars parameter. The first found to be defined will be
  408.         used. envvars defaults to the search path used in GNU gettext;
  409.         it must always contain the variable name \'LANG\'.
  410.  
  411.         Except for the code \'C\', the language code corresponds to RFC
  412.         1766.  code and encoding can be None in case the values cannot
  413.         be determined.
  414.  
  415.     '''
  416.     
  417.     try:
  418.         import _locale
  419.         (code, encoding) = _locale._getdefaultlocale()
  420.     except (ImportError, AttributeError):
  421.         pass
  422.  
  423.     if sys.platform == 'win32' and code and code[:2] == '0x':
  424.         code = windows_locale.get(int(code, 0))
  425.     
  426.     return (code, encoding)
  427.     import os
  428.     lookup = os.environ.get
  429.     for variable in envvars:
  430.         localename = lookup(variable, None)
  431.         if localename:
  432.             if variable == 'LANGUAGE':
  433.                 localename = localename.split(':')[0]
  434.             
  435.             break
  436.             continue
  437.     else:
  438.         localename = 'C'
  439.     return _parse_localename(localename)
  440.  
  441.  
  442. def getlocale(category = LC_CTYPE):
  443.     """ Returns the current setting for the given locale category as
  444.         tuple (language code, encoding).
  445.  
  446.         category may be one of the LC_* value except LC_ALL. It
  447.         defaults to LC_CTYPE.
  448.  
  449.         Except for the code 'C', the language code corresponds to RFC
  450.         1766.  code and encoding can be None in case the values cannot
  451.         be determined.
  452.  
  453.     """
  454.     localename = _setlocale(category)
  455.     if category == LC_ALL and ';' in localename:
  456.         raise TypeError, 'category LC_ALL is not supported'
  457.     
  458.     return _parse_localename(localename)
  459.  
  460.  
  461. def setlocale(category, locale = None):
  462.     ''' Set the locale for the given category.  The locale can be
  463.         a string, a locale tuple (language code, encoding), or None.
  464.  
  465.         Locale tuples are converted to strings the locale aliasing
  466.         engine.  Locale strings are passed directly to the C lib.
  467.  
  468.         category may be given as one of the LC_* values.
  469.  
  470.     '''
  471.     if locale and type(locale) is not type(''):
  472.         locale = normalize(_build_localename(locale))
  473.     
  474.     return _setlocale(category, locale)
  475.  
  476.  
  477. def resetlocale(category = LC_ALL):
  478.     ''' Sets the locale for category to the default setting.
  479.  
  480.         The default setting is determined by calling
  481.         getdefaultlocale(). category defaults to LC_ALL.
  482.  
  483.     '''
  484.     _setlocale(category, _build_localename(getdefaultlocale()))
  485.  
  486. if sys.platform in ('win32', 'darwin', 'mac'):
  487.     
  488.     def getpreferredencoding(do_setlocale = True):
  489.         '''Return the charset that the user is likely using.'''
  490.         import _locale
  491.         return _locale._getdefaultlocale()[1]
  492.  
  493. else:
  494.     
  495.     try:
  496.         CODESET
  497.     except NameError:
  498.         
  499.         def getpreferredencoding(do_setlocale = True):
  500.             '''Return the charset that the user is likely using,
  501.             by looking at environment variables.'''
  502.             return getdefaultlocale()[1]
  503.  
  504.  
  505.     
  506.     def getpreferredencoding(do_setlocale = True):
  507.         '''Return the charset that the user is likely using,
  508.             according to the system configuration.'''
  509.         if do_setlocale:
  510.             oldloc = setlocale(LC_CTYPE)
  511.             setlocale(LC_CTYPE, '')
  512.             result = nl_langinfo(CODESET)
  513.             setlocale(LC_CTYPE, oldloc)
  514.             return result
  515.         else:
  516.             return nl_langinfo(CODESET)
  517.  
  518. locale_encoding_alias = {
  519.     '437': 'C',
  520.     'c': 'C',
  521.     'en': 'ISO8859-1',
  522.     'jis': 'JIS7',
  523.     'jis7': 'JIS7',
  524.     'ajec': 'eucJP',
  525.     'ascii': 'ISO8859-1',
  526.     'latin_1': 'ISO8859-1',
  527.     'iso8859_1': 'ISO8859-1',
  528.     'iso8859_10': 'ISO8859-10',
  529.     'iso8859_11': 'ISO8859-11',
  530.     'iso8859_13': 'ISO8859-13',
  531.     'iso8859_14': 'ISO8859-14',
  532.     'iso8859_15': 'ISO8859-15',
  533.     'iso8859_2': 'ISO8859-2',
  534.     'iso8859_3': 'ISO8859-3',
  535.     'iso8859_4': 'ISO8859-4',
  536.     'iso8859_5': 'ISO8859-5',
  537.     'iso8859_6': 'ISO8859-6',
  538.     'iso8859_7': 'ISO8859-7',
  539.     'iso8859_8': 'ISO8859-8',
  540.     'iso8859_9': 'ISO8859-9',
  541.     'iso2022_jp': 'JIS7',
  542.     'shift_jis': 'SJIS',
  543.     'tactis': 'TACTIS',
  544.     'euc_jp': 'eucJP',
  545.     'euc_kr': 'eucKR',
  546.     'utf_8': 'UTF8',
  547.     'koi8_r': 'KOI8-R',
  548.     'koi8_u': 'KOI8-U' }
  549. locale_alias = {
  550.     'a3': 'a3_AZ.KOI8-C',
  551.     'a3_az': 'a3_AZ.KOI8-C',
  552.     'a3_az.koi8c': 'a3_AZ.KOI8-C',
  553.     'af': 'af_ZA.ISO8859-1',
  554.     'af_za': 'af_ZA.ISO8859-1',
  555.     'af_za.iso88591': 'af_ZA.ISO8859-1',
  556.     'am': 'am_ET.UTF-8',
  557.     'american': 'en_US.ISO8859-1',
  558.     'american.iso88591': 'en_US.ISO8859-1',
  559.     'ar': 'ar_AA.ISO8859-6',
  560.     'ar_aa': 'ar_AA.ISO8859-6',
  561.     'ar_aa.iso88596': 'ar_AA.ISO8859-6',
  562.     'ar_ae': 'ar_AE.ISO8859-6',
  563.     'ar_bh': 'ar_BH.ISO8859-6',
  564.     'ar_dz': 'ar_DZ.ISO8859-6',
  565.     'ar_eg': 'ar_EG.ISO8859-6',
  566.     'ar_eg.iso88596': 'ar_EG.ISO8859-6',
  567.     'ar_iq': 'ar_IQ.ISO8859-6',
  568.     'ar_jo': 'ar_JO.ISO8859-6',
  569.     'ar_kw': 'ar_KW.ISO8859-6',
  570.     'ar_lb': 'ar_LB.ISO8859-6',
  571.     'ar_ly': 'ar_LY.ISO8859-6',
  572.     'ar_ma': 'ar_MA.ISO8859-6',
  573.     'ar_om': 'ar_OM.ISO8859-6',
  574.     'ar_qa': 'ar_QA.ISO8859-6',
  575.     'ar_sa': 'ar_SA.ISO8859-6',
  576.     'ar_sa.iso88596': 'ar_SA.ISO8859-6',
  577.     'ar_sd': 'ar_SD.ISO8859-6',
  578.     'ar_sy': 'ar_SY.ISO8859-6',
  579.     'ar_tn': 'ar_TN.ISO8859-6',
  580.     'ar_ye': 'ar_YE.ISO8859-6',
  581.     'arabic': 'ar_AA.ISO8859-6',
  582.     'arabic.iso88596': 'ar_AA.ISO8859-6',
  583.     'az': 'az_AZ.ISO8859-9E',
  584.     'az_az': 'az_AZ.ISO8859-9E',
  585.     'az_az.iso88599e': 'az_AZ.ISO8859-9E',
  586.     'be': 'be_BY.CP1251',
  587.     'be_by': 'be_BY.CP1251',
  588.     'be_by.cp1251': 'be_BY.CP1251',
  589.     'be_by.microsoftcp1251': 'be_BY.CP1251',
  590.     'bg': 'bg_BG.CP1251',
  591.     'bg_bg': 'bg_BG.CP1251',
  592.     'bg_bg.cp1251': 'bg_BG.CP1251',
  593.     'bg_bg.iso88595': 'bg_BG.ISO8859-5',
  594.     'bg_bg.koi8r': 'bg_BG.KOI8-R',
  595.     'bg_bg.microsoftcp1251': 'bg_BG.CP1251',
  596.     'bokmal': 'nb_NO.ISO8859-1',
  597.     'bokm\xe5l': 'nb_NO.ISO8859-1',
  598.     'br': 'br_FR.ISO8859-1',
  599.     'br_fr': 'br_FR.ISO8859-1',
  600.     'br_fr.iso88591': 'br_FR.ISO8859-1',
  601.     'br_fr.iso885914': 'br_FR.ISO8859-14',
  602.     'br_fr.iso885915': 'br_FR.ISO8859-15',
  603.     'br_fr@euro': 'br_FR.ISO8859-15',
  604.     'bulgarian': 'bg_BG.CP1251',
  605.     'c': 'C',
  606.     'c-french': 'fr_CA.ISO8859-1',
  607.     'c-french.iso88591': 'fr_CA.ISO8859-1',
  608.     'c.en': 'C',
  609.     'c.iso88591': 'en_US.ISO8859-1',
  610.     'c_c': 'C',
  611.     'c_c.c': 'C',
  612.     'ca': 'ca_ES.ISO8859-1',
  613.     'ca_es': 'ca_ES.ISO8859-1',
  614.     'ca_es.iso88591': 'ca_ES.ISO8859-1',
  615.     'ca_es.iso885915': 'ca_ES.ISO8859-15',
  616.     'ca_es@euro': 'ca_ES.ISO8859-15',
  617.     'catalan': 'ca_ES.ISO8859-1',
  618.     'cextend': 'en_US.ISO8859-1',
  619.     'cextend.en': 'en_US.ISO8859-1',
  620.     'chinese-s': 'zh_CN.eucCN',
  621.     'chinese-t': 'zh_TW.eucTW',
  622.     'croatian': 'hr_HR.ISO8859-2',
  623.     'cs': 'cs_CZ.ISO8859-2',
  624.     'cs_cs': 'cs_CZ.ISO8859-2',
  625.     'cs_cs.iso88592': 'cs_CZ.ISO8859-2',
  626.     'cs_cz': 'cs_CZ.ISO8859-2',
  627.     'cs_cz.iso88592': 'cs_CZ.ISO8859-2',
  628.     'cy': 'cy_GB.ISO8859-1',
  629.     'cy_gb': 'cy_GB.ISO8859-1',
  630.     'cy_gb.iso88591': 'cy_GB.ISO8859-1',
  631.     'cy_gb.iso885914': 'cy_GB.ISO8859-14',
  632.     'cy_gb.iso885915': 'cy_GB.ISO8859-15',
  633.     'cy_gb@euro': 'cy_GB.ISO8859-15',
  634.     'cz': 'cs_CZ.ISO8859-2',
  635.     'cz_cz': 'cs_CZ.ISO8859-2',
  636.     'czech': 'cs_CZ.ISO8859-2',
  637.     'da': 'da_DK.ISO8859-1',
  638.     'da_dk': 'da_DK.ISO8859-1',
  639.     'da_dk.88591': 'da_DK.ISO8859-1',
  640.     'da_dk.885915': 'da_DK.ISO8859-15',
  641.     'da_dk.iso88591': 'da_DK.ISO8859-1',
  642.     'da_dk.iso885915': 'da_DK.ISO8859-15',
  643.     'da_dk@euro': 'da_DK.ISO8859-15',
  644.     'danish': 'da_DK.ISO8859-1',
  645.     'danish.iso88591': 'da_DK.ISO8859-1',
  646.     'dansk': 'da_DK.ISO8859-1',
  647.     'de': 'de_DE.ISO8859-1',
  648.     'de_at': 'de_AT.ISO8859-1',
  649.     'de_at.iso88591': 'de_AT.ISO8859-1',
  650.     'de_at.iso885915': 'de_AT.ISO8859-15',
  651.     'de_at@euro': 'de_AT.ISO8859-15',
  652.     'de_be': 'de_BE.ISO8859-1',
  653.     'de_be.iso88591': 'de_BE.ISO8859-1',
  654.     'de_be.iso885915': 'de_BE.ISO8859-15',
  655.     'de_be@euro': 'de_BE.ISO8859-15',
  656.     'de_ch': 'de_CH.ISO8859-1',
  657.     'de_ch.iso88591': 'de_CH.ISO8859-1',
  658.     'de_ch.iso885915': 'de_CH.ISO8859-15',
  659.     'de_ch@euro': 'de_CH.ISO8859-15',
  660.     'de_de': 'de_DE.ISO8859-1',
  661.     'de_de.88591': 'de_DE.ISO8859-1',
  662.     'de_de.885915': 'de_DE.ISO8859-15',
  663.     'de_de.885915@euro': 'de_DE.ISO8859-15',
  664.     'de_de.iso88591': 'de_DE.ISO8859-1',
  665.     'de_de.iso885915': 'de_DE.ISO8859-15',
  666.     'de_de@euro': 'de_DE.ISO8859-15',
  667.     'de_lu': 'de_LU.ISO8859-1',
  668.     'de_lu.iso88591': 'de_LU.ISO8859-1',
  669.     'de_lu.iso885915': 'de_LU.ISO8859-15',
  670.     'de_lu@euro': 'de_LU.ISO8859-15',
  671.     'deutsch': 'de_DE.ISO8859-1',
  672.     'dutch': 'nl_NL.ISO8859-1',
  673.     'dutch.iso88591': 'nl_BE.ISO8859-1',
  674.     'ee': 'ee_EE.ISO8859-4',
  675.     'ee_ee': 'ee_EE.ISO8859-4',
  676.     'ee_ee.iso88594': 'ee_EE.ISO8859-4',
  677.     'eesti': 'et_EE.ISO8859-1',
  678.     'el': 'el_GR.ISO8859-7',
  679.     'el_gr': 'el_GR.ISO8859-7',
  680.     'el_gr.iso88597': 'el_GR.ISO8859-7',
  681.     'el_gr@euro': 'el_GR.ISO8859-15',
  682.     'en': 'en_US.ISO8859-1',
  683.     'en.iso88591': 'en_US.ISO8859-1',
  684.     'en_au': 'en_AU.ISO8859-1',
  685.     'en_au.iso88591': 'en_AU.ISO8859-1',
  686.     'en_be': 'en_BE.ISO8859-1',
  687.     'en_be@euro': 'en_BE.ISO8859-15',
  688.     'en_bw': 'en_BW.ISO8859-1',
  689.     'en_ca': 'en_CA.ISO8859-1',
  690.     'en_ca.iso88591': 'en_CA.ISO8859-1',
  691.     'en_gb': 'en_GB.ISO8859-1',
  692.     'en_gb.88591': 'en_GB.ISO8859-1',
  693.     'en_gb.iso88591': 'en_GB.ISO8859-1',
  694.     'en_gb.iso885915': 'en_GB.ISO8859-15',
  695.     'en_gb@euro': 'en_GB.ISO8859-15',
  696.     'en_hk': 'en_HK.ISO8859-1',
  697.     'en_ie': 'en_IE.ISO8859-1',
  698.     'en_ie.iso88591': 'en_IE.ISO8859-1',
  699.     'en_ie.iso885915': 'en_IE.ISO8859-15',
  700.     'en_ie@euro': 'en_IE.ISO8859-15',
  701.     'en_in': 'en_IN.ISO8859-1',
  702.     'en_nz': 'en_NZ.ISO8859-1',
  703.     'en_nz.iso88591': 'en_NZ.ISO8859-1',
  704.     'en_ph': 'en_PH.ISO8859-1',
  705.     'en_sg': 'en_SG.ISO8859-1',
  706.     'en_uk': 'en_GB.ISO8859-1',
  707.     'en_us': 'en_US.ISO8859-1',
  708.     'en_us.88591': 'en_US.ISO8859-1',
  709.     'en_us.885915': 'en_US.ISO8859-15',
  710.     'en_us.iso88591': 'en_US.ISO8859-1',
  711.     'en_us.iso885915': 'en_US.ISO8859-15',
  712.     'en_us.iso885915@euro': 'en_US.ISO8859-15',
  713.     'en_us@euro': 'en_US.ISO8859-15',
  714.     'en_us@euro@euro': 'en_US.ISO8859-15',
  715.     'en_za': 'en_ZA.ISO8859-1',
  716.     'en_za.88591': 'en_ZA.ISO8859-1',
  717.     'en_za.iso88591': 'en_ZA.ISO8859-1',
  718.     'en_za.iso885915': 'en_ZA.ISO8859-15',
  719.     'en_za@euro': 'en_ZA.ISO8859-15',
  720.     'en_zw': 'en_ZW.ISO8859-1',
  721.     'eng_gb': 'en_GB.ISO8859-1',
  722.     'eng_gb.8859': 'en_GB.ISO8859-1',
  723.     'english': 'en_EN.ISO8859-1',
  724.     'english.iso88591': 'en_EN.ISO8859-1',
  725.     'english_uk': 'en_GB.ISO8859-1',
  726.     'english_uk.8859': 'en_GB.ISO8859-1',
  727.     'english_united-states': 'en_US.ISO8859-1',
  728.     'english_united-states.437': 'C',
  729.     'english_us': 'en_US.ISO8859-1',
  730.     'english_us.8859': 'en_US.ISO8859-1',
  731.     'english_us.ascii': 'en_US.ISO8859-1',
  732.     'eo': 'eo_XX.ISO8859-3',
  733.     'eo_eo': 'eo_EO.ISO8859-3',
  734.     'eo_eo.iso88593': 'eo_EO.ISO8859-3',
  735.     'eo_xx': 'eo_XX.ISO8859-3',
  736.     'eo_xx.iso88593': 'eo_XX.ISO8859-3',
  737.     'es': 'es_ES.ISO8859-1',
  738.     'es_ar': 'es_AR.ISO8859-1',
  739.     'es_ar.iso88591': 'es_AR.ISO8859-1',
  740.     'es_bo': 'es_BO.ISO8859-1',
  741.     'es_bo.iso88591': 'es_BO.ISO8859-1',
  742.     'es_cl': 'es_CL.ISO8859-1',
  743.     'es_cl.iso88591': 'es_CL.ISO8859-1',
  744.     'es_co': 'es_CO.ISO8859-1',
  745.     'es_co.iso88591': 'es_CO.ISO8859-1',
  746.     'es_cr': 'es_CR.ISO8859-1',
  747.     'es_cr.iso88591': 'es_CR.ISO8859-1',
  748.     'es_do': 'es_DO.ISO8859-1',
  749.     'es_do.iso88591': 'es_DO.ISO8859-1',
  750.     'es_ec': 'es_EC.ISO8859-1',
  751.     'es_ec.iso88591': 'es_EC.ISO8859-1',
  752.     'es_es': 'es_ES.ISO8859-1',
  753.     'es_es.88591': 'es_ES.ISO8859-1',
  754.     'es_es.iso88591': 'es_ES.ISO8859-1',
  755.     'es_es.iso885915': 'es_ES.ISO8859-15',
  756.     'es_es@euro': 'es_ES.ISO8859-15',
  757.     'es_gt': 'es_GT.ISO8859-1',
  758.     'es_gt.iso88591': 'es_GT.ISO8859-1',
  759.     'es_hn': 'es_HN.ISO8859-1',
  760.     'es_hn.iso88591': 'es_HN.ISO8859-1',
  761.     'es_mx': 'es_MX.ISO8859-1',
  762.     'es_mx.iso88591': 'es_MX.ISO8859-1',
  763.     'es_ni': 'es_NI.ISO8859-1',
  764.     'es_ni.iso88591': 'es_NI.ISO8859-1',
  765.     'es_pa': 'es_PA.ISO8859-1',
  766.     'es_pa.iso88591': 'es_PA.ISO8859-1',
  767.     'es_pa.iso885915': 'es_PA.ISO8859-15',
  768.     'es_pa@euro': 'es_PA.ISO8859-15',
  769.     'es_pe': 'es_PE.ISO8859-1',
  770.     'es_pe.iso88591': 'es_PE.ISO8859-1',
  771.     'es_pe.iso885915': 'es_PE.ISO8859-15',
  772.     'es_pe@euro': 'es_PE.ISO8859-15',
  773.     'es_pr': 'es_PR.ISO8859-1',
  774.     'es_pr.iso88591': 'es_PR.ISO8859-1',
  775.     'es_py': 'es_PY.ISO8859-1',
  776.     'es_py.iso88591': 'es_PY.ISO8859-1',
  777.     'es_py.iso885915': 'es_PY.ISO8859-15',
  778.     'es_py@euro': 'es_PY.ISO8859-15',
  779.     'es_sv': 'es_SV.ISO8859-1',
  780.     'es_sv.iso88591': 'es_SV.ISO8859-1',
  781.     'es_sv.iso885915': 'es_SV.ISO8859-15',
  782.     'es_sv@euro': 'es_SV.ISO8859-15',
  783.     'es_us': 'es_US.ISO8859-1',
  784.     'es_uy': 'es_UY.ISO8859-1',
  785.     'es_uy.iso88591': 'es_UY.ISO8859-1',
  786.     'es_uy.iso885915': 'es_UY.ISO8859-15',
  787.     'es_uy@euro': 'es_UY.ISO8859-15',
  788.     'es_ve': 'es_VE.ISO8859-1',
  789.     'es_ve.iso88591': 'es_VE.ISO8859-1',
  790.     'es_ve.iso885915': 'es_VE.ISO8859-15',
  791.     'es_ve@euro': 'es_VE.ISO8859-15',
  792.     'estonian': 'et_EE.ISO8859-1',
  793.     'et': 'et_EE.ISO8859-15',
  794.     'et_ee': 'et_EE.ISO8859-15',
  795.     'et_ee.iso88591': 'et_EE.ISO8859-1',
  796.     'et_ee.iso885913': 'et_EE.ISO8859-13',
  797.     'et_ee.iso885915': 'et_EE.ISO8859-15',
  798.     'et_ee.iso88594': 'et_EE.ISO8859-4',
  799.     'et_ee@euro': 'et_EE.ISO8859-15',
  800.     'eu': 'eu_ES.ISO8859-1',
  801.     'eu_es': 'eu_ES.ISO8859-1',
  802.     'eu_es.iso88591': 'eu_ES.ISO8859-1',
  803.     'eu_es.iso885915': 'eu_ES.ISO8859-15',
  804.     'eu_es@euro': 'eu_ES.ISO8859-15',
  805.     'fa': 'fa_IR.UTF-8',
  806.     'fa_ir': 'fa_IR.UTF-8',
  807.     'fa_ir.isiri3342': 'fa_IR.ISIRI-3342',
  808.     'fi': 'fi_FI.ISO8859-15',
  809.     'fi_fi': 'fi_FI.ISO8859-15',
  810.     'fi_fi.88591': 'fi_FI.ISO8859-1',
  811.     'fi_fi.iso88591': 'fi_FI.ISO8859-1',
  812.     'fi_fi.iso885915': 'fi_FI.ISO8859-15',
  813.     'fi_fi.utf8@euro': 'fi_FI.UTF-8',
  814.     'fi_fi@euro': 'fi_FI.ISO8859-15',
  815.     'finnish': 'fi_FI.ISO8859-1',
  816.     'finnish.iso88591': 'fi_FI.ISO8859-1',
  817.     'fo': 'fo_FO.ISO8859-1',
  818.     'fo_fo': 'fo_FO.ISO8859-1',
  819.     'fo_fo.iso88591': 'fo_FO.ISO8859-1',
  820.     'fo_fo.iso885915': 'fo_FO.ISO8859-15',
  821.     'fo_fo@euro': 'fo_FO.ISO8859-15',
  822.     'fr': 'fr_FR.ISO8859-1',
  823.     'fr_be': 'fr_BE.ISO8859-1',
  824.     'fr_be.88591': 'fr_BE.ISO8859-1',
  825.     'fr_be.iso88591': 'fr_BE.ISO8859-1',
  826.     'fr_be.iso885915': 'fr_BE.ISO8859-15',
  827.     'fr_be@euro': 'fr_BE.ISO8859-15',
  828.     'fr_ca': 'fr_CA.ISO8859-1',
  829.     'fr_ca.88591': 'fr_CA.ISO8859-1',
  830.     'fr_ca.iso88591': 'fr_CA.ISO8859-1',
  831.     'fr_ca.iso885915': 'fr_CA.ISO8859-15',
  832.     'fr_ca@euro': 'fr_CA.ISO8859-15',
  833.     'fr_ch': 'fr_CH.ISO8859-1',
  834.     'fr_ch.88591': 'fr_CH.ISO8859-1',
  835.     'fr_ch.iso88591': 'fr_CH.ISO8859-1',
  836.     'fr_ch.iso885915': 'fr_CH.ISO8859-15',
  837.     'fr_ch@euro': 'fr_CH.ISO8859-15',
  838.     'fr_fr': 'fr_FR.ISO8859-1',
  839.     'fr_fr.88591': 'fr_FR.ISO8859-1',
  840.     'fr_fr.iso88591': 'fr_FR.ISO8859-1',
  841.     'fr_fr.iso885915': 'fr_FR.ISO8859-15',
  842.     'fr_fr@euro': 'fr_FR.ISO8859-15',
  843.     'fr_lu': 'fr_LU.ISO8859-1',
  844.     'fr_lu.88591': 'fr_LU.ISO8859-1',
  845.     'fr_lu.iso88591': 'fr_LU.ISO8859-1',
  846.     'fr_lu.iso885915': 'fr_LU.ISO8859-15',
  847.     'fr_lu@euro': 'fr_LU.ISO8859-15',
  848.     'fran\xe7ais': 'fr_FR.ISO8859-1',
  849.     'fre_fr': 'fr_FR.ISO8859-1',
  850.     'fre_fr.8859': 'fr_FR.ISO8859-1',
  851.     'french': 'fr_FR.ISO8859-1',
  852.     'french.iso88591': 'fr_CH.ISO8859-1',
  853.     'french_france': 'fr_FR.ISO8859-1',
  854.     'french_france.8859': 'fr_FR.ISO8859-1',
  855.     'ga': 'ga_IE.ISO8859-1',
  856.     'ga_ie': 'ga_IE.ISO8859-1',
  857.     'ga_ie.iso88591': 'ga_IE.ISO8859-1',
  858.     'ga_ie.iso885914': 'ga_IE.ISO8859-14',
  859.     'ga_ie.iso885915': 'ga_IE.ISO8859-15',
  860.     'ga_ie@euro': 'ga_IE.ISO8859-15',
  861.     'galego': 'gl_ES.ISO8859-1',
  862.     'galician': 'gl_ES.ISO8859-1',
  863.     'gd': 'gd_GB.ISO8859-1',
  864.     'gd_gb': 'gd_GB.ISO8859-1',
  865.     'gd_gb.iso88591': 'gd_GB.ISO8859-1',
  866.     'gd_gb.iso885914': 'gd_GB.ISO8859-14',
  867.     'gd_gb.iso885915': 'gd_GB.ISO8859-15',
  868.     'gd_gb@euro': 'gd_GB.ISO8859-15',
  869.     'ger_de': 'de_DE.ISO8859-1',
  870.     'ger_de.8859': 'de_DE.ISO8859-1',
  871.     'german': 'de_DE.ISO8859-1',
  872.     'german.iso88591': 'de_CH.ISO8859-1',
  873.     'german_germany': 'de_DE.ISO8859-1',
  874.     'german_germany.8859': 'de_DE.ISO8859-1',
  875.     'gl': 'gl_ES.ISO8859-1',
  876.     'gl_es': 'gl_ES.ISO8859-1',
  877.     'gl_es.iso88591': 'gl_ES.ISO8859-1',
  878.     'gl_es.iso885915': 'gl_ES.ISO8859-15',
  879.     'gl_es@euro': 'gl_ES.ISO8859-15',
  880.     'greek': 'el_GR.ISO8859-7',
  881.     'greek.iso88597': 'el_GR.ISO8859-7',
  882.     'gv': 'gv_GB.ISO8859-1',
  883.     'gv_gb': 'gv_GB.ISO8859-1',
  884.     'gv_gb.iso88591': 'gv_GB.ISO8859-1',
  885.     'gv_gb.iso885914': 'gv_GB.ISO8859-14',
  886.     'gv_gb.iso885915': 'gv_GB.ISO8859-15',
  887.     'gv_gb@euro': 'gv_GB.ISO8859-15',
  888.     'he': 'he_IL.ISO8859-8',
  889.     'he_il': 'he_IL.ISO8859-8',
  890.     'he_il.cp1255': 'he_IL.CP1255',
  891.     'he_il.iso88598': 'he_IL.ISO8859-8',
  892.     'he_il.microsoftcp1255': 'he_IL.CP1255',
  893.     'hebrew': 'iw_IL.ISO8859-8',
  894.     'hebrew.iso88598': 'iw_IL.ISO8859-8',
  895.     'hi': 'hi_IN.ISCII-DEV',
  896.     'hi_in': 'hi_IN.ISCII-DEV',
  897.     'hi_in.isciidev': 'hi_IN.ISCII-DEV',
  898.     'hr': 'hr_HR.ISO8859-2',
  899.     'hr_hr': 'hr_HR.ISO8859-2',
  900.     'hr_hr.iso88592': 'hr_HR.ISO8859-2',
  901.     'hrvatski': 'hr_HR.ISO8859-2',
  902.     'hu': 'hu_HU.ISO8859-2',
  903.     'hu_hu': 'hu_HU.ISO8859-2',
  904.     'hu_hu.iso88592': 'hu_HU.ISO8859-2',
  905.     'hungarian': 'hu_HU.ISO8859-2',
  906.     'icelandic': 'is_IS.ISO8859-1',
  907.     'icelandic.iso88591': 'is_IS.ISO8859-1',
  908.     'id': 'id_ID.ISO8859-1',
  909.     'id_id': 'id_ID.ISO8859-1',
  910.     'in': 'id_ID.ISO8859-1',
  911.     'in_id': 'id_ID.ISO8859-1',
  912.     'is': 'is_IS.ISO8859-1',
  913.     'is_is': 'is_IS.ISO8859-1',
  914.     'is_is.iso88591': 'is_IS.ISO8859-1',
  915.     'is_is.iso885915': 'is_IS.ISO8859-15',
  916.     'is_is@euro': 'is_IS.ISO8859-15',
  917.     'iso-8859-1': 'en_US.ISO8859-1',
  918.     'iso-8859-15': 'en_US.ISO8859-15',
  919.     'iso8859-1': 'en_US.ISO8859-1',
  920.     'iso8859-15': 'en_US.ISO8859-15',
  921.     'iso_8859_1': 'en_US.ISO8859-1',
  922.     'iso_8859_15': 'en_US.ISO8859-15',
  923.     'it': 'it_IT.ISO8859-1',
  924.     'it_ch': 'it_CH.ISO8859-1',
  925.     'it_ch.iso88591': 'it_CH.ISO8859-1',
  926.     'it_ch.iso885915': 'it_CH.ISO8859-15',
  927.     'it_ch@euro': 'it_CH.ISO8859-15',
  928.     'it_it': 'it_IT.ISO8859-1',
  929.     'it_it.88591': 'it_IT.ISO8859-1',
  930.     'it_it.iso88591': 'it_IT.ISO8859-1',
  931.     'it_it.iso885915': 'it_IT.ISO8859-15',
  932.     'it_it@euro': 'it_IT.ISO8859-15',
  933.     'italian': 'it_IT.ISO8859-1',
  934.     'italian.iso88591': 'it_IT.ISO8859-1',
  935.     'iu': 'iu_CA.NUNACOM-8',
  936.     'iu_ca': 'iu_CA.NUNACOM-8',
  937.     'iu_ca.nunacom8': 'iu_CA.NUNACOM-8',
  938.     'iw': 'he_IL.ISO8859-8',
  939.     'iw_il': 'he_IL.ISO8859-8',
  940.     'iw_il.iso88598': 'he_IL.ISO8859-8',
  941.     'ja': 'ja_JP.eucJP',
  942.     'ja.jis': 'ja_JP.JIS7',
  943.     'ja.sjis': 'ja_JP.SJIS',
  944.     'ja_jp': 'ja_JP.eucJP',
  945.     'ja_jp.ajec': 'ja_JP.eucJP',
  946.     'ja_jp.euc': 'ja_JP.eucJP',
  947.     'ja_jp.eucjp': 'ja_JP.eucJP',
  948.     'ja_jp.iso-2022-jp': 'ja_JP.JIS7',
  949.     'ja_jp.iso2022jp': 'ja_JP.JIS7',
  950.     'ja_jp.jis': 'ja_JP.JIS7',
  951.     'ja_jp.jis7': 'ja_JP.JIS7',
  952.     'ja_jp.mscode': 'ja_JP.SJIS',
  953.     'ja_jp.sjis': 'ja_JP.SJIS',
  954.     'ja_jp.ujis': 'ja_JP.eucJP',
  955.     'japan': 'ja_JP.eucJP',
  956.     'japanese': 'ja_JP.eucJP',
  957.     'japanese-euc': 'ja_JP.eucJP',
  958.     'japanese.euc': 'ja_JP.eucJP',
  959.     'japanese.sjis': 'ja_JP.SJIS',
  960.     'jp_jp': 'ja_JP.eucJP',
  961.     'ka': 'ka_GE.GEORGIAN-ACADEMY',
  962.     'ka_ge': 'ka_GE.GEORGIAN-ACADEMY',
  963.     'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY',
  964.     'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS',
  965.     'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY',
  966.     'kl': 'kl_GL.ISO8859-1',
  967.     'kl_gl': 'kl_GL.ISO8859-1',
  968.     'kl_gl.iso88591': 'kl_GL.ISO8859-1',
  969.     'kl_gl.iso885915': 'kl_GL.ISO8859-15',
  970.     'kl_gl@euro': 'kl_GL.ISO8859-15',
  971.     'ko': 'ko_KR.eucKR',
  972.     'ko_kr': 'ko_KR.eucKR',
  973.     'ko_kr.euc': 'ko_KR.eucKR',
  974.     'ko_kr.euckr': 'ko_KR.eucKR',
  975.     'korean': 'ko_KR.eucKR',
  976.     'korean.euc': 'ko_KR.eucKR',
  977.     'kw': 'kw_GB.ISO8859-1',
  978.     'kw_gb': 'kw_GB.ISO8859-1',
  979.     'kw_gb.iso88591': 'kw_GB.ISO8859-1',
  980.     'kw_gb.iso885914': 'kw_GB.ISO8859-14',
  981.     'kw_gb.iso885915': 'kw_GB.ISO8859-15',
  982.     'kw_gb@euro': 'kw_GB.ISO8859-15',
  983.     'lithuanian': 'lt_LT.ISO8859-13',
  984.     'lo': 'lo_LA.MULELAO-1',
  985.     'lo_la': 'lo_LA.MULELAO-1',
  986.     'lo_la.cp1133': 'lo_LA.IBM-CP1133',
  987.     'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133',
  988.     'lo_la.mulelao1': 'lo_LA.MULELAO-1',
  989.     'lt': 'lt_LT.ISO8859-13',
  990.     'lt_lt': 'lt_LT.ISO8859-13',
  991.     'lt_lt.iso885913': 'lt_LT.ISO8859-13',
  992.     'lt_lt.iso88594': 'lt_LT.ISO8859-4',
  993.     'lv': 'lv_LV.ISO8859-13',
  994.     'lv_lv': 'lv_LV.ISO8859-13',
  995.     'lv_lv.iso885913': 'lv_LV.ISO8859-13',
  996.     'lv_lv.iso88594': 'lv_LV.ISO8859-4',
  997.     'mi': 'mi_NZ.ISO8859-1',
  998.     'mi_nz': 'mi_NZ.ISO8859-1',
  999.     'mi_nz.iso88591': 'mi_NZ.ISO8859-1',
  1000.     'mk': 'mk_MK.ISO8859-5',
  1001.     'mk_mk': 'mk_MK.ISO8859-5',
  1002.     'mk_mk.cp1251': 'mk_MK.CP1251',
  1003.     'mk_mk.iso88595': 'mk_MK.ISO8859-5',
  1004.     'mk_mk.microsoftcp1251': 'mk_MK.CP1251',
  1005.     'ms': 'ms_MY.ISO8859-1',
  1006.     'ms_my': 'ms_MY.ISO8859-1',
  1007.     'ms_my.iso88591': 'ms_MY.ISO8859-1',
  1008.     'mt': 'mt_MT.ISO8859-3',
  1009.     'mt_mt': 'mt_MT.ISO8859-3',
  1010.     'mt_mt.iso88593': 'mt_MT.ISO8859-3',
  1011.     'nb': 'nb_NO.ISO8859-1',
  1012.     'nb_no': 'nb_NO.ISO8859-1',
  1013.     'nb_no.88591': 'nb_NO.ISO8859-1',
  1014.     'nb_no.iso88591': 'nb_NO.ISO8859-1',
  1015.     'nb_no.iso885915': 'nb_NO.ISO8859-15',
  1016.     'nb_no@euro': 'nb_NO.ISO8859-15',
  1017.     'nl': 'nl_NL.ISO8859-1',
  1018.     'nl_be': 'nl_BE.ISO8859-1',
  1019.     'nl_be.88591': 'nl_BE.ISO8859-1',
  1020.     'nl_be.iso88591': 'nl_BE.ISO8859-1',
  1021.     'nl_be.iso885915': 'nl_BE.ISO8859-15',
  1022.     'nl_be@euro': 'nl_BE.ISO8859-15',
  1023.     'nl_nl': 'nl_NL.ISO8859-1',
  1024.     'nl_nl.88591': 'nl_NL.ISO8859-1',
  1025.     'nl_nl.iso88591': 'nl_NL.ISO8859-1',
  1026.     'nl_nl.iso885915': 'nl_NL.ISO8859-15',
  1027.     'nl_nl@euro': 'nl_NL.ISO8859-15',
  1028.     'nn': 'nn_NO.ISO8859-1',
  1029.     'nn_no': 'nn_NO.ISO8859-1',
  1030.     'nn_no.88591': 'nn_NO.ISO8859-1',
  1031.     'nn_no.iso88591': 'nn_NO.ISO8859-1',
  1032.     'nn_no.iso885915': 'nn_NO.ISO8859-15',
  1033.     'nn_no@euro': 'nn_NO.ISO8859-15',
  1034.     'no': 'no_NO.ISO8859-1',
  1035.     'no@nynorsk': 'ny_NO.ISO8859-1',
  1036.     'no_no': 'no_NO.ISO8859-1',
  1037.     'no_no.88591': 'no_NO.ISO8859-1',
  1038.     'no_no.iso88591': 'no_NO.ISO8859-1',
  1039.     'no_no.iso885915': 'no_NO.ISO8859-15',
  1040.     'no_no@euro': 'no_NO.ISO8859-15',
  1041.     'norwegian': 'no_NO.ISO8859-1',
  1042.     'norwegian.iso88591': 'no_NO.ISO8859-1',
  1043.     'ny': 'ny_NO.ISO8859-1',
  1044.     'ny_no': 'ny_NO.ISO8859-1',
  1045.     'ny_no.88591': 'ny_NO.ISO8859-1',
  1046.     'ny_no.iso88591': 'ny_NO.ISO8859-1',
  1047.     'ny_no.iso885915': 'ny_NO.ISO8859-15',
  1048.     'ny_no@euro': 'ny_NO.ISO8859-15',
  1049.     'nynorsk': 'nn_NO.ISO8859-1',
  1050.     'oc': 'oc_FR.ISO8859-1',
  1051.     'oc_fr': 'oc_FR.ISO8859-1',
  1052.     'oc_fr.iso88591': 'oc_FR.ISO8859-1',
  1053.     'oc_fr.iso885915': 'oc_FR.ISO8859-15',
  1054.     'oc_fr@euro': 'oc_FR.ISO8859-15',
  1055.     'pd': 'pd_US.ISO8859-1',
  1056.     'pd_de': 'pd_DE.ISO8859-1',
  1057.     'pd_de.iso88591': 'pd_DE.ISO8859-1',
  1058.     'pd_de.iso885915': 'pd_DE.ISO8859-15',
  1059.     'pd_de@euro': 'pd_DE.ISO8859-15',
  1060.     'pd_us': 'pd_US.ISO8859-1',
  1061.     'pd_us.iso88591': 'pd_US.ISO8859-1',
  1062.     'pd_us.iso885915': 'pd_US.ISO8859-15',
  1063.     'pd_us@euro': 'pd_US.ISO8859-15',
  1064.     'ph': 'ph_PH.ISO8859-1',
  1065.     'ph_ph': 'ph_PH.ISO8859-1',
  1066.     'ph_ph.iso88591': 'ph_PH.ISO8859-1',
  1067.     'pl': 'pl_PL.ISO8859-2',
  1068.     'pl_pl': 'pl_PL.ISO8859-2',
  1069.     'pl_pl.iso88592': 'pl_PL.ISO8859-2',
  1070.     'polish': 'pl_PL.ISO8859-2',
  1071.     'portuguese': 'pt_PT.ISO8859-1',
  1072.     'portuguese.iso88591': 'pt_PT.ISO8859-1',
  1073.     'portuguese_brazil': 'pt_BR.ISO8859-1',
  1074.     'portuguese_brazil.8859': 'pt_BR.ISO8859-1',
  1075.     'posix': 'C',
  1076.     'posix-utf2': 'C',
  1077.     'pp': 'pp_AN.ISO8859-1',
  1078.     'pp_an': 'pp_AN.ISO8859-1',
  1079.     'pp_an.iso88591': 'pp_AN.ISO8859-1',
  1080.     'pt': 'pt_PT.ISO8859-1',
  1081.     'pt_br': 'pt_BR.ISO8859-1',
  1082.     'pt_br.88591': 'pt_BR.ISO8859-1',
  1083.     'pt_br.iso88591': 'pt_BR.ISO8859-1',
  1084.     'pt_br.iso885915': 'pt_BR.ISO8859-15',
  1085.     'pt_br@euro': 'pt_BR.ISO8859-15',
  1086.     'pt_pt': 'pt_PT.ISO8859-1',
  1087.     'pt_pt.88591': 'pt_PT.ISO8859-1',
  1088.     'pt_pt.iso88591': 'pt_PT.ISO8859-1',
  1089.     'pt_pt.iso885915': 'pt_PT.ISO8859-15',
  1090.     'pt_pt.utf8@euro': 'pt_PT.UTF-8',
  1091.     'pt_pt@euro': 'pt_PT.ISO8859-15',
  1092.     'ro': 'ro_RO.ISO8859-2',
  1093.     'ro_ro': 'ro_RO.ISO8859-2',
  1094.     'ro_ro.iso88592': 'ro_RO.ISO8859-2',
  1095.     'romanian': 'ro_RO.ISO8859-2',
  1096.     'ru': 'ru_RU.ISO8859-5',
  1097.     'ru_ru': 'ru_RU.ISO8859-5',
  1098.     'ru_ru.cp1251': 'ru_RU.CP1251',
  1099.     'ru_ru.iso88595': 'ru_RU.ISO8859-5',
  1100.     'ru_ru.koi8r': 'ru_RU.KOI8-R',
  1101.     'ru_ru.microsoftcp1251': 'ru_RU.CP1251',
  1102.     'ru_ua': 'ru_UA.KOI8-U',
  1103.     'ru_ua.cp1251': 'ru_UA.CP1251',
  1104.     'ru_ua.koi8u': 'ru_UA.KOI8-U',
  1105.     'ru_ua.microsoftcp1251': 'ru_UA.CP1251',
  1106.     'rumanian': 'ro_RO.ISO8859-2',
  1107.     'russian': 'ru_RU.ISO8859-5',
  1108.     'se_no': 'se_NO.UTF-8',
  1109.     'serbocroatian': 'sh_YU.ISO8859-2',
  1110.     'sh': 'sh_YU.ISO8859-2',
  1111.     'sh_hr': 'sh_HR.ISO8859-2',
  1112.     'sh_hr.iso88592': 'sh_HR.ISO8859-2',
  1113.     'sh_sp': 'sh_YU.ISO8859-2',
  1114.     'sh_yu': 'sh_YU.ISO8859-2',
  1115.     'sk': 'sk_SK.ISO8859-2',
  1116.     'sk_sk': 'sk_SK.ISO8859-2',
  1117.     'sk_sk.iso88592': 'sk_SK.ISO8859-2',
  1118.     'sl': 'sl_SI.ISO8859-2',
  1119.     'sl_cs': 'sl_CS.ISO8859-2',
  1120.     'sl_si': 'sl_SI.ISO8859-2',
  1121.     'sl_si.iso88592': 'sl_SI.ISO8859-2',
  1122.     'slovak': 'sk_SK.ISO8859-2',
  1123.     'slovene': 'sl_SI.ISO8859-2',
  1124.     'slovenian': 'sl_SI.ISO8859-2',
  1125.     'sp': 'sp_YU.ISO8859-5',
  1126.     'sp_yu': 'sp_YU.ISO8859-5',
  1127.     'spanish': 'es_ES.ISO8859-1',
  1128.     'spanish.iso88591': 'es_ES.ISO8859-1',
  1129.     'spanish_spain': 'es_ES.ISO8859-1',
  1130.     'spanish_spain.8859': 'es_ES.ISO8859-1',
  1131.     'sq': 'sq_AL.ISO8859-2',
  1132.     'sq_al': 'sq_AL.ISO8859-2',
  1133.     'sq_al.iso88592': 'sq_AL.ISO8859-2',
  1134.     'sr': 'sr_YU.ISO8859-5',
  1135.     'sr@cyrillic': 'sr_YU.ISO8859-5',
  1136.     'sr_sp': 'sr_SP.ISO8859-2',
  1137.     'sr_yu': 'sr_YU.ISO8859-5',
  1138.     'sr_yu.cp1251@cyrillic': 'sr_YU.CP1251',
  1139.     'sr_yu.iso88592': 'sr_YU.ISO8859-2',
  1140.     'sr_yu.iso88595': 'sr_YU.ISO8859-5',
  1141.     'sr_yu.iso88595@cyrillic': 'sr_YU.ISO8859-5',
  1142.     'sr_yu.microsoftcp1251@cyrillic': 'sr_YU.CP1251',
  1143.     'sr_yu.utf8@cyrillic': 'sr_YU.UTF-8',
  1144.     'sr_yu@cyrillic': 'sr_YU.ISO8859-5',
  1145.     'sv': 'sv_SE.ISO8859-1',
  1146.     'sv_fi': 'sv_FI.ISO8859-1',
  1147.     'sv_fi.iso88591': 'sv_FI.ISO8859-1',
  1148.     'sv_fi.iso885915': 'sv_FI.ISO8859-15',
  1149.     'sv_fi@euro': 'sv_FI.ISO8859-15',
  1150.     'sv_se': 'sv_SE.ISO8859-1',
  1151.     'sv_se.88591': 'sv_SE.ISO8859-1',
  1152.     'sv_se.iso88591': 'sv_SE.ISO8859-1',
  1153.     'sv_se.iso885915': 'sv_SE.ISO8859-15',
  1154.     'sv_se@euro': 'sv_SE.ISO8859-15',
  1155.     'swedish': 'sv_SE.ISO8859-1',
  1156.     'swedish.iso88591': 'sv_SE.ISO8859-1',
  1157.     'ta': 'ta_IN.TSCII-0',
  1158.     'ta_in': 'ta_IN.TSCII-0',
  1159.     'ta_in.tscii': 'ta_IN.TSCII-0',
  1160.     'ta_in.tscii0': 'ta_IN.TSCII-0',
  1161.     'tg': 'tg_TJ.KOI8-C',
  1162.     'tg_tj': 'tg_TJ.KOI8-C',
  1163.     'tg_tj.koi8c': 'tg_TJ.KOI8-C',
  1164.     'th': 'th_TH.ISO8859-11',
  1165.     'th_th': 'th_TH.ISO8859-11',
  1166.     'th_th.iso885911': 'th_TH.ISO8859-11',
  1167.     'th_th.tactis': 'th_TH.TIS620',
  1168.     'th_th.tis620': 'th_TH.TIS620',
  1169.     'thai': 'th_TH.ISO8859-11',
  1170.     'tl': 'tl_PH.ISO8859-1',
  1171.     'tl_ph': 'tl_PH.ISO8859-1',
  1172.     'tl_ph.iso88591': 'tl_PH.ISO8859-1',
  1173.     'tr': 'tr_TR.ISO8859-9',
  1174.     'tr_tr': 'tr_TR.ISO8859-9',
  1175.     'tr_tr.iso88599': 'tr_TR.ISO8859-9',
  1176.     'tt': 'tt_RU.TATAR-CYR',
  1177.     'tt_ru': 'tt_RU.TATAR-CYR',
  1178.     'tt_ru.koi8c': 'tt_RU.KOI8-C',
  1179.     'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR',
  1180.     'turkish': 'tr_TR.ISO8859-9',
  1181.     'turkish.iso88599': 'tr_TR.ISO8859-9',
  1182.     'uk': 'uk_UA.KOI8-U',
  1183.     'uk_ua': 'uk_UA.KOI8-U',
  1184.     'uk_ua.cp1251': 'uk_UA.CP1251',
  1185.     'uk_ua.iso88595': 'uk_UA.ISO8859-5',
  1186.     'uk_ua.koi8u': 'uk_UA.KOI8-U',
  1187.     'uk_ua.microsoftcp1251': 'uk_UA.CP1251',
  1188.     'univ': 'en_US.UTF-8',
  1189.     'universal': 'en_US.UTF-8',
  1190.     'universal.utf8@ucs4': 'en_US.UTF-8',
  1191.     'ur': 'ur_PK.CP1256',
  1192.     'ur_pk': 'ur_PK.CP1256',
  1193.     'ur_pk.cp1256': 'ur_PK.CP1256',
  1194.     'ur_pk.microsoftcp1256': 'ur_PK.CP1256',
  1195.     'uz': 'uz_UZ.UTF-8',
  1196.     'uz_uz': 'uz_UZ.UTF-8',
  1197.     'vi': 'vi_VN.TCVN',
  1198.     'vi_vn': 'vi_VN.TCVN',
  1199.     'vi_vn.tcvn': 'vi_VN.TCVN',
  1200.     'vi_vn.tcvn5712': 'vi_VN.TCVN',
  1201.     'vi_vn.viscii': 'vi_VN.VISCII',
  1202.     'vi_vn.viscii111': 'vi_VN.VISCII',
  1203.     'wa': 'wa_BE.ISO8859-1',
  1204.     'wa_be': 'wa_BE.ISO8859-1',
  1205.     'wa_be.iso88591': 'wa_BE.ISO8859-1',
  1206.     'wa_be.iso885915': 'wa_BE.ISO8859-15',
  1207.     'wa_be@euro': 'wa_BE.ISO8859-15',
  1208.     'xh': 'xh.ISO8859-1',
  1209.     'xh_za': 'xh_ZA.ISO8859-1',
  1210.     'yi': 'yi_US.CP1255',
  1211.     'yi_us': 'yi_US.CP1255',
  1212.     'yi_us.cp1255': 'yi_US.CP1255',
  1213.     'yi_us.microsoftcp1255': 'yi_US.CP1255',
  1214.     'zh': 'zh_CN.eucCN',
  1215.     'zh_cn': 'zh_CN.gb2312',
  1216.     'zh_cn.big5': 'zh_TW.big5',
  1217.     'zh_cn.euc': 'zh_CN.eucCN',
  1218.     'zh_cn.gb18030': 'zh_CN.gb18030',
  1219.     'zh_cn.gb2312': 'zh_CN.gb2312',
  1220.     'zh_cn.gbk': 'zh_CN.gbk',
  1221.     'zh_hk': 'zh_HK.big5hkscs',
  1222.     'zh_hk.big5': 'zh_HK.big5',
  1223.     'zh_hk.big5hkscs': 'zh_HK.big5hkscs',
  1224.     'zh_tw': 'zh_TW.big5',
  1225.     'zh_tw.big5': 'zh_TW.big5',
  1226.     'zh_tw.euc': 'zh_TW.eucTW' }
  1227. windows_locale = {
  1228.     1078: 'af_ZA',
  1229.     1052: 'sq_AL',
  1230.     1025: 'ar_SA',
  1231.     2049: 'ar_IQ',
  1232.     3073: 'ar_EG',
  1233.     4097: 'ar_LY',
  1234.     5121: 'ar_DZ',
  1235.     6145: 'ar_MA',
  1236.     7169: 'ar_TN',
  1237.     8193: 'ar_OM',
  1238.     9217: 'ar_YE',
  1239.     10241: 'ar_SY',
  1240.     11265: 'ar_JO',
  1241.     12289: 'ar_LB',
  1242.     13313: 'ar_KW',
  1243.     14337: 'ar_AE',
  1244.     15361: 'ar_BH',
  1245.     16385: 'ar_QA',
  1246.     1067: 'hy_AM',
  1247.     1068: 'az_AZ',
  1248.     2092: 'az_AZ',
  1249.     1069: 'eu_ES',
  1250.     1059: 'be_BY',
  1251.     1093: 'bn_IN',
  1252.     8218: 'bs_BA',
  1253.     5146: 'bs_BA',
  1254.     1150: 'br_FR',
  1255.     1026: 'bg_BG',
  1256.     1027: 'ca_ES',
  1257.     4: 'zh_CHS',
  1258.     1028: 'zh_TW',
  1259.     2052: 'zh_CN',
  1260.     3076: 'zh_HK',
  1261.     4100: 'zh_SG',
  1262.     5124: 'zh_MO',
  1263.     31748: 'zh_CHT',
  1264.     1050: 'hr_HR',
  1265.     4122: 'hr_BA',
  1266.     1029: 'cs_CZ',
  1267.     1030: 'da_DK',
  1268.     1164: 'gbz_AF',
  1269.     1125: 'div_MV',
  1270.     1043: 'nl_NL',
  1271.     2067: 'nl_BE',
  1272.     1033: 'en_US',
  1273.     2057: 'en_GB',
  1274.     3081: 'en_AU',
  1275.     4105: 'en_CA',
  1276.     5129: 'en_NZ',
  1277.     6153: 'en_IE',
  1278.     7177: 'en_ZA',
  1279.     8201: 'en_JA',
  1280.     9225: 'en_CB',
  1281.     10249: 'en_BZ',
  1282.     11273: 'en_TT',
  1283.     12297: 'en_ZW',
  1284.     13321: 'en_PH',
  1285.     1061: 'et_EE',
  1286.     1080: 'fo_FO',
  1287.     1124: 'fil_PH',
  1288.     1035: 'fi_FI',
  1289.     1036: 'fr_FR',
  1290.     2060: 'fr_BE',
  1291.     3084: 'fr_CA',
  1292.     4108: 'fr_CH',
  1293.     5132: 'fr_LU',
  1294.     6156: 'fr_MC',
  1295.     1122: 'fy_NL',
  1296.     1110: 'gl_ES',
  1297.     1079: 'ka_GE',
  1298.     1031: 'de_DE',
  1299.     2055: 'de_CH',
  1300.     3079: 'de_AT',
  1301.     4103: 'de_LU',
  1302.     5127: 'de_LI',
  1303.     1032: 'el_GR',
  1304.     1095: 'gu_IN',
  1305.     1037: 'he_IL',
  1306.     1081: 'hi_IN',
  1307.     1038: 'hu_HU',
  1308.     1039: 'is_IS',
  1309.     1057: 'id_ID',
  1310.     1117: 'iu_CA',
  1311.     2141: 'iu_CA',
  1312.     2108: 'ga_IE',
  1313.     1076: 'xh_ZA',
  1314.     1077: 'zu_ZA',
  1315.     1040: 'it_IT',
  1316.     2064: 'it_CH',
  1317.     1041: 'ja_JP',
  1318.     1099: 'kn_IN',
  1319.     1087: 'kk_KZ',
  1320.     1111: 'kok_IN',
  1321.     1042: 'ko_KR',
  1322.     1088: 'ky_KG',
  1323.     1062: 'lv_LV',
  1324.     1063: 'lt_LT',
  1325.     1134: 'lb_LU',
  1326.     1071: 'mk_MK',
  1327.     1086: 'ms_MY',
  1328.     2110: 'ms_BN',
  1329.     1100: 'ml_IN',
  1330.     1082: 'mt_MT',
  1331.     1153: 'mi_NZ',
  1332.     1146: 'arn_CL',
  1333.     1102: 'mr_IN',
  1334.     1148: 'moh_CA',
  1335.     1104: 'mn_MN',
  1336.     1121: 'ne_NP',
  1337.     1044: 'nb_NO',
  1338.     2068: 'nn_NO',
  1339.     1154: 'oc_FR',
  1340.     1096: 'or_IN',
  1341.     1123: 'ps_AF',
  1342.     1065: 'fa_IR',
  1343.     1045: 'pl_PL',
  1344.     1046: 'pt_BR',
  1345.     2070: 'pt_PT',
  1346.     1094: 'pa_IN',
  1347.     1131: 'quz_BO',
  1348.     2155: 'quz_EC',
  1349.     3179: 'quz_PE',
  1350.     1048: 'ro_RO',
  1351.     1047: 'rm_CH',
  1352.     1049: 'ru_RU',
  1353.     9275: 'smn_FI',
  1354.     4155: 'smj_NO',
  1355.     5179: 'smj_SE',
  1356.     1083: 'se_NO',
  1357.     2107: 'se_SE',
  1358.     3131: 'se_FI',
  1359.     8251: 'sms_FI',
  1360.     6203: 'sma_NO',
  1361.     7227: 'sma_SE',
  1362.     1103: 'sa_IN',
  1363.     3098: 'sr_SP',
  1364.     7194: 'sr_BA',
  1365.     2074: 'sr_SP',
  1366.     6170: 'sr_BA',
  1367.     1132: 'ns_ZA',
  1368.     1074: 'tn_ZA',
  1369.     1051: 'sk_SK',
  1370.     1060: 'sl_SI',
  1371.     1034: 'es_ES',
  1372.     2058: 'es_MX',
  1373.     3082: 'es_ES',
  1374.     4106: 'es_GT',
  1375.     5130: 'es_CR',
  1376.     6154: 'es_PA',
  1377.     7178: 'es_DO',
  1378.     8202: 'es_VE',
  1379.     9226: 'es_CO',
  1380.     10250: 'es_PE',
  1381.     11274: 'es_AR',
  1382.     12298: 'es_EC',
  1383.     13322: 'es_CL',
  1384.     14346: 'es_UR',
  1385.     15370: 'es_PY',
  1386.     16394: 'es_BO',
  1387.     17418: 'es_SV',
  1388.     18442: 'es_HN',
  1389.     19466: 'es_NI',
  1390.     20490: 'es_PR',
  1391.     1089: 'sw_KE',
  1392.     1053: 'sv_SE',
  1393.     2077: 'sv_FI',
  1394.     1114: 'syr_SY',
  1395.     1097: 'ta_IN',
  1396.     1092: 'tt_RU',
  1397.     1098: 'te_IN',
  1398.     1054: 'th_TH',
  1399.     1055: 'tr_TR',
  1400.     1058: 'uk_UA',
  1401.     1056: 'ur_PK',
  1402.     2080: 'ur_IN',
  1403.     1091: 'uz_UZ',
  1404.     2115: 'uz_UZ',
  1405.     1066: 'vi_VN',
  1406.     1106: 'cy_GB' }
  1407.  
  1408. def _print_locale():
  1409.     ''' Test function.
  1410.     '''
  1411.     categories = { }
  1412.     
  1413.     def _init_categories(categories = categories):
  1414.         for k, v in globals().items():
  1415.             if k[:3] == 'LC_':
  1416.                 categories[k] = v
  1417.                 continue
  1418.         
  1419.  
  1420.     _init_categories()
  1421.     del categories['LC_ALL']
  1422.     print 'Locale defaults as determined by getdefaultlocale():'
  1423.     print '-' * 72
  1424.     (lang, enc) = getdefaultlocale()
  1425.     print 'Language: ',
  1426.     if not lang:
  1427.         pass
  1428.     print '(undefined)'
  1429.     print 'Encoding: ',
  1430.     if not enc:
  1431.         pass
  1432.     print '(undefined)'
  1433.     print 
  1434.     print 'Locale settings on startup:'
  1435.     print '-' * 72
  1436.     for name, category in categories.items():
  1437.         print name, '...'
  1438.         (lang, enc) = getlocale(category)
  1439.         print '   Language: ',
  1440.         if not lang:
  1441.             pass
  1442.         print '(undefined)'
  1443.         print '   Encoding: ',
  1444.         if not enc:
  1445.             pass
  1446.         print '(undefined)'
  1447.         print 
  1448.     
  1449.     print 
  1450.     print 'Locale settings after calling resetlocale():'
  1451.     print '-' * 72
  1452.     resetlocale()
  1453.     for name, category in categories.items():
  1454.         print name, '...'
  1455.         (lang, enc) = getlocale(category)
  1456.         print '   Language: ',
  1457.         if not lang:
  1458.             pass
  1459.         print '(undefined)'
  1460.         print '   Encoding: ',
  1461.         if not enc:
  1462.             pass
  1463.         print '(undefined)'
  1464.         print 
  1465.     
  1466.     
  1467.     try:
  1468.         setlocale(LC_ALL, '')
  1469.     except:
  1470.         print 'NOTE:'
  1471.         print 'setlocale(LC_ALL, "") does not support the default locale'
  1472.         print 'given in the OS environment variables.'
  1473.  
  1474.     print 
  1475.     print 'Locale settings after calling setlocale(LC_ALL, ""):'
  1476.     print '-' * 72
  1477.     for name, category in categories.items():
  1478.         print name, '...'
  1479.         (lang, enc) = getlocale(category)
  1480.         print '   Language: ',
  1481.         if not lang:
  1482.             pass
  1483.         print '(undefined)'
  1484.         print '   Encoding: ',
  1485.         if not enc:
  1486.             pass
  1487.         print '(undefined)'
  1488.         print 
  1489.     
  1490.  
  1491.  
  1492. try:
  1493.     LC_MESSAGES
  1494. except NameError:
  1495.     pass
  1496.  
  1497. __all__.append('LC_MESSAGES')
  1498. if __name__ == '__main__':
  1499.     print 'Locale aliasing:'
  1500.     print 
  1501.     _print_locale()
  1502.     print 
  1503.     print 'Number formatting:'
  1504.     print 
  1505.     _test()
  1506.  
  1507.